package main

import (
	"fmt"
	"math/rand"
	"time"
)

func main() {
	//随机生成20以内的20个非0正整数，第单数个（不是索引）累加求和，第偶数个累乘求积
	r1 := rand.New(rand.NewSource(time.Now().UnixNano()))
	a := 1
	b := 0
	for i := 0; i < 20; i++ {
		x := r1.Intn(21)
		if x%2 == 0 {
			a = a * x
		} else {
			b = b + x
		}
	}
	fmt.Printf("偶数累积为：%v\n", a)
	fmt.Printf("奇数累和为：%v\n", b)
}
